package com.pp.controller;


import com.pp.bean.GovGoodsEacheStor;
import com.pp.service.GovGoodsEacheStorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 商品评价 前端控制器
 * </p>
 *
 * @author 张子艺
 * @since 2019-04-03
 */
@Controller
@RequestMapping("/govGoodsEacheStor")
@Api(value = "商品多评价类controller", tags = {"商品评价"})
public class GovGoodsEacheStorController {
    @Autowired
    GovGoodsEacheStorService goodsEacheStorService;

    /**
     * 添加商品评价
     */
    @RequestMapping(value = "/saveGoodStor", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "添加商品评价")
    public Map<String, Object> saveGoodStor(@RequestBody GovGoodsEacheStor goodsEacheStor) {
        return goodsEacheStorService.saveGoodStor(goodsEacheStor);
    }

    /**
     * 查询商品评价
     */
    @RequestMapping(value = "/findGoodStor", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询商品评价")
    public Collection saveGoodStor(@RequestParam("goodId") Long goodId, @RequestParam("lang") Integer lang) {
        Map map = new HashMap();
        map.put("relacation_id", goodId);
        map.put("lang", lang);
        return goodsEacheStorService.listByMap(map);
    }
}
